

import 'package:json_annotation/json_annotation.dart';
import 'package:wechat_manager/network/model/base_model.dart';

part 'article_model.g.dart';

@JsonSerializable()
class ArticleModel extends BaseModel {
  @JsonKey(name: 'total_count')
  int? totalCount;
  @JsonKey(name: 'item_count')
  int? itemCount;
  @JsonKey(name: 'item')
  List<ArticleItemModel>? items;


  ArticleModel({this.totalCount, this.itemCount});

  factory ArticleModel.fromJson(Map<String, dynamic> json) =>
      _$ArticleModelFromJson(json);

  Map<String, dynamic> toJson() => _$ArticleModelToJson(this);
}

@JsonSerializable()
class ArticleItemModel {
  @JsonKey(name: 'media_id')
  String? mediaId;
  @JsonKey(name: 'update_time')
  int? updateTime;
  @JsonKey(name: 'content')
  ArticleItemContentModel? content;

  ArticleItemModel({this.mediaId, this.updateTime, this.content});

  factory ArticleItemModel.fromJson(Map<String, dynamic> json) =>
      _$ArticleItemModelFromJson(json);

  Map<String, dynamic> toJson() => _$ArticleItemModelToJson(this);
}

@JsonSerializable()
class ArticleItemContentModel {
  @JsonKey(name: "news_item")
  List<ArticleItemContentItemModel>? newsItem;

  ArticleItemContentModel({this.newsItem});

  factory ArticleItemContentModel.fromJson(Map<String, dynamic> json) =>
      _$ArticleItemContentModelFromJson(json);

  Map<String, dynamic> toJson() => _$ArticleItemContentModelToJson(this);
}

@JsonSerializable()
class ArticleItemContentItemModel {
  @JsonKey(name: "article_type")
  String? articleType;
  String? title;
  String? author;
  String? digest;
  String? content;
  @JsonKey(name: "content_source_url")
  String? contentSourceUrl;
  @JsonKey(name: "thumb_media_id")
  String? thumbMediaId;
  String? url;
  @JsonKey(name: "thumb_url")
  String? thumbUrl;

  ArticleItemContentItemModel(this.articleType, this.title, this.author,
      this.digest, this.content, this.contentSourceUrl, this.thumbMediaId,
      this.url,this.thumbUrl);

  factory ArticleItemContentItemModel.fromJson(Map<String, dynamic> json) =>
      _$ArticleItemContentItemModelFromJson(json);

  Map<String, dynamic> toJson() => _$ArticleItemContentItemModelToJson(this);
}